﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAO;
using DVO;
using System.Web.Security;

public partial class Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string username = txtUserName.Text.Trim();
        string pass = Common.GenerateHashDigestMD5(txtpass.Text.Trim(), Common.HashMethod.MD5);
        BLL_Working ObjBLL=new BLL_Working();
        ins_Member_SelectByUserNameResult ObjInfo = new ins_Member_SelectByUserNameResult();
        ObjInfo = ObjBLL.Login(username, pass);
        if (ObjInfo != null)
        {
            FormsAuthentication.RedirectFromLoginPage(txtUserName.Text.Trim(), false);
            //FormsAuthentication.SetAuthCookie(ObjInfo.Level.ToString(), true);
            Session["r"] = ObjInfo.Level.ToString();
            Response.Redirect("Welcome.aspx");
        }
    }
}